/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:${USER}
 * Date:${YEAR}-${MONTH}-${DAY}
 * ${TIME}
 */
public class Main {
    public String removeDuplicates(String s) {
        StringBuffer ret=new StringBuffer();
        for(int i=0;i<s.length();i++){
            char ch=s.charAt(i);
            if(ret.length()>0&&ch==ret.charAt(ret.length()-1)){
                ret.deleteCharAt(ret.length()-1);//出
            }else{
                ret.append(ch);//进
            }
        }
        return ret.toString();
    }
}